/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author user
 */
@Entity
@Table(name = "weathernotification")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Weathernotification.findAll", query = "SELECT w FROM Weathernotification w"),
    @NamedQuery(name = "Weathernotification.findById", query = "SELECT w FROM Weathernotification w WHERE w.id = :id"),
    @NamedQuery(name = "Weathernotification.findByWeatherDescription", query = "SELECT w FROM Weathernotification w WHERE w.weatherDescription = :weatherDescription"),
    @NamedQuery(name = "Weathernotification.findByReceiver", query = "SELECT w FROM Weathernotification w WHERE w.receiver = :receiver"),
    @NamedQuery(name = "Weathernotification.findByDateTime", query = "SELECT w FROM Weathernotification w WHERE w.dateTime = :dateTime"),
    @NamedQuery(name = "Weathernotification.findByStatus", query = "SELECT w FROM Weathernotification w WHERE w.status = :status")})
public class Weathernotification implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Size(max = 255)
    @Column(name = "WeatherDescription")
    private String weatherDescription;
    @Size(max = 45)
    @Column(name = "Receiver")
    private String receiver;
    @Column(name = "DateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateTime;
    @Size(max = 45)
    @Column(name = "Status")
    private String status;
    @ManyToMany(mappedBy = "weathernotificationCollection")
    private Collection<User> userCollection;
    @OneToMany(mappedBy = "weatherNotificationID")
    private Collection<Weatherinformation> weatherinformationCollection;
    @OneToMany(mappedBy = "weatherNotificationID")
    private Collection<Event> eventCollection;

    public Weathernotification() {
    }

    public Weathernotification(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getWeatherDescription() {
        return weatherDescription;
    }

    public void setWeatherDescription(String weatherDescription) {
        this.weatherDescription = weatherDescription;
    }

    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @XmlTransient
    public Collection<User> getUserCollection() {
        return userCollection;
    }

    public void setUserCollection(Collection<User> userCollection) {
        this.userCollection = userCollection;
    }

    @XmlTransient
    public Collection<Weatherinformation> getWeatherinformationCollection() {
        return weatherinformationCollection;
    }

    public void setWeatherinformationCollection(Collection<Weatherinformation> weatherinformationCollection) {
        this.weatherinformationCollection = weatherinformationCollection;
    }

    @XmlTransient
    public Collection<Event> getEventCollection() {
        return eventCollection;
    }

    public void setEventCollection(Collection<Event> eventCollection) {
        this.eventCollection = eventCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Weathernotification)) {
            return false;
        }
        Weathernotification other = (Weathernotification) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Weathernotification[ id=" + id + " ]";
    }
    
}
